package util

func SliceToKeyMap[T comparable](s []T) map[T]struct{} {
	m := make(map[T]struct{})
	for _, t := range s {
		m[t] = struct{}{}
	}
	return m
}

func KeyMapToSlice[T comparable](m map[T]struct{}) (s []T) {
	s = make([]T, len(m))
	for k := range m {
		s = append(s, k)
	}
	return s
}

// func Insert[T any](entity *T, opts ...OptionFunc) *gorm.DB {
